<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>111</li>
        <li>222</li>
        <li>333</li>
    </ul>
    <script>
        // let 块级元素
        var s=document.querySelectorAll("ul li")
        for(let i=0;i<s.length;i++){
            // s[i].index=i
            s[i].onclick=function(){
                console.log(i)
            }
        }
        console.log('重新')
    </script>
</body>
</html>